$(function () {


    var jsonMite = {
        '18': ['ANNOUNCEMENTS'],
        '22': ['FEATURED ','NEWS'],
        '46': ['FEATURED ','PRODUCTS'],
        '47': ['OUR ','PRODUCTS'],
        '48': ['BEST ','SELLERS'],
        '49': ['INVESTOR ','NEWS'],
        '51': ['FEATURE ','NEWS']
    }

   var  indexjson = titleUrl.cate_id

console.log(jsonMite[indexjson][0]);

 $('#articleLilistHead').html('<span style="">'+jsonMite[indexjson][0]+  '</span>'+ isarrayTure(jsonMite[indexjson][1]));

 function isarrayTure(data) {
     if (data) {
        return data;
     }else{
        return ' ';

     }
 }

    console.log(titleUrl);
    $.ajax({
        url: 'http://47.89.20.150/czlycms/index.php?m=Web&a=article_List&cate_id='+titleUrl.cate_id,
        type: 'GET',
        dataType: 'JSONP'
    })
    .done(function(data) {
        console.log("success");
        console.log(data);
        articlelistFun(data.article_list);
        tcdPageCode(data.page.totalPage)
        
    })
    .fail(function() {
        console.log("error");
    })
    .always(function() {
        console.log("complete");
    });

})





    function tcdPageCode(pageCounts){

        $(".tcdPageCode").createPage({
            pageCount:pageCounts,
            current:1,
            backFn:function(p){
                console.log(p);
                 $.ajax({
                    url: 'http://47.89.20.150/czlycms/index.php?m=Web&a=article_List&cate_id='+titleUrl.cate_id+'&p='+p,
                    type: 'GET',
                    dataType: 'JSONP'
                })
                .done(function(data) {
                    console.log("success");
                    console.log(data);
                    articlelistFun(data.article_list);
                    
                })

            }
        });

    }






// article
 function articlelistFun(data){
    var Con = $('#articleLilist');
    var html = '';

    for (var i = 0; i < data.length; i++) {
        var cn = '<li>'+
                '<a class="clearfloat" href="article.html?article_id='+data[i].article_id+'">'+
                    '<div class="imgC"><img src="'+data[i].image_url+'" alt=""></div>'+
                    '<div class="word">'+
                        '<h3>'+data[i].title+'</h3>'+
                        '<p>'+data[i].seo_description+'</p>'+
                    '</div>'+
                '</a>'+
            '</li>';
        html+=cn;
        
    }
    Con.html(html);
 }
// article end